package com.xzh.wms.enums;


import lombok.Getter;
import lombok.Setter;

import java.util.Arrays;
import java.util.Optional;


public enum PoStatus {

    NEW(1,"新建"),
    APPROVE(10,"审核通过"),
    TRANSIT(20,"配货中"),
    FINISH(30,"入库（完成）"),
    REJECT(40,"拒绝"),
    REPEAL(120,"作废");

    @Setter @Getter
    private int code;
    @Setter @Getter
    private String message;

    PoStatus(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public static PoStatus getByCode(int code){

        PoStatus[] status= PoStatus.values();
        Optional<PoStatus> first = Arrays.stream(status).filter(items->items.code == code).findFirst();
        return first.orElse(null);

    }
}
